Aashi commited on
Commit
657202e
1 Parent(s): dc10bd3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -23
app.py CHANGED
@@ -45,35 +45,13 @@ def process_input(text, image=None):
45
  inputs = processor(prompt, return_tensors="pt").to(model.device)
46
 
47
  # Generate output from the model
48
- outputs = model.generate(**inputs, max_new_tokens=100)
49
 
50
  # Decode the output to return a readable text
51
  decoded_output = processor.decode(outputs[0], skip_special_tokens=True)
52
 
53
  return decoded_output
54
 
55
- # Gradio Interface Setup
56
- # def demo():
57
- # # Define Gradio input and output components
58
- # text_input = gr.Textbox(label="Text Input", placeholder="Enter text here", lines=5)
59
-
60
- # # Use type="pil" to work with PIL Image objects
61
- # image_input = gr.Image(label="Upload an Image", type="pil")
62
-
63
- # output = gr.Textbox(label="Model Output", lines=5)
64
-
65
- # # Define the interface layout
66
- # interface = gr.Interface(
67
- # fn=process_input,
68
- # inputs=[text_input, image_input],
69
- # outputs=output,
70
- # title="Llama 3.2 Multimodal Text-Image Analyzer",
71
- # description="Upload an image and/or provide text for analysis using the Llama 3.2 Vision Model."
72
- # )
73
-
74
- # # Launch the demo
75
- # interface.launch()
76
-
77
  def demo():
78
  # Define Gradio input and output components
79
  text_input = gr.Textbox(label="Text Input", placeholder="Enter text here", lines=5)
 
45
  inputs = processor(prompt, return_tensors="pt").to(model.device)
46
 
47
  # Generate output from the model
48
+ outputs = model.generate(**inputs, max_new_tokens=50)
49
 
50
  # Decode the output to return a readable text
51
  decoded_output = processor.decode(outputs[0], skip_special_tokens=True)
52
 
53
  return decoded_output
54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  def demo():
56
  # Define Gradio input and output components
57
  text_input = gr.Textbox(label="Text Input", placeholder="Enter text here", lines=5)