hassanelmghari commited on
Commit
034341f
·
verified ·
1 Parent(s): efae69e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -24
app.py CHANGED
@@ -87,20 +87,7 @@ def bot_streaming(message, history, together_api_key, max_new_tokens=250, temper
87
  else:
88
  yield f"An error occurred: {str(e)}"
89
 
90
- css = """
91
- #chatbot-container {
92
- height: calc(100vh - 230px);
93
- overflow-y: auto;
94
- }
95
- #chatbot-textbox {
96
- position: fixed;
97
- bottom: 20px;
98
- left: 20px;
99
- right: 20px;
100
- }
101
- """
102
-
103
- with gr.Blocks(css=css) as demo:
104
  gr.Markdown("# Meta Llama-3.2-11B-Vision-Instruct (FREE)")
105
  gr.Markdown("Try the new Llama 3.2 11B Vision API by Meta for free through Together AI. Upload an image, and start chatting about it. Just paste in your Together AI API key and get started!")
106
 
@@ -127,16 +114,12 @@ with gr.Blocks(css=css) as demo:
127
  label="Temperature"
128
  )
129
 
130
- with gr.Column(elem_id="chatbot-container"):
131
- chatbot = gr.ChatInterface(
132
- fn=bot_streaming,
133
- textbox=gr.MultimodalTextbox(elem_id="chatbot-textbox"),
134
- additional_inputs=[together_api_key, max_new_tokens, temperature],
135
- cache_examples=False,
136
- stop_btn="Stop Generation",
137
- fill_height=True,
138
- multimodal=True
139
- )
140
 
141
  if __name__ == "__main__":
142
  demo.launch(debug=True)
 
87
  else:
88
  yield f"An error occurred: {str(e)}"
89
 
90
+ with gr.Blocks() as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  gr.Markdown("# Meta Llama-3.2-11B-Vision-Instruct (FREE)")
92
  gr.Markdown("Try the new Llama 3.2 11B Vision API by Meta for free through Together AI. Upload an image, and start chatting about it. Just paste in your Together AI API key and get started!")
93
 
 
114
  label="Temperature"
115
  )
116
 
117
+ chatbot = gr.Chatbot()
118
+ msg = gr.MultimodalTextbox(label="Enter text or upload an image")
119
+ clear = gr.Button("Clear")
120
+
121
+ msg.submit(bot_streaming, [msg, chatbot, together_api_key, max_new_tokens, temperature], chatbot)
122
+ clear.click(lambda: None, None, chatbot, queue=False)
 
 
 
 
123
 
124
  if __name__ == "__main__":
125
  demo.launch(debug=True)