Omnibus commited on
Commit
05d25f5
·
1 Parent(s): eb7426e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -10
app.py CHANGED
@@ -150,7 +150,8 @@ def compress_data(c, history):
150
 
151
 
152
 
153
- def summarize(inp,file=None):
 
154
  if file !=None:
155
  try:
156
  with open(file,"r") as f:
@@ -176,10 +177,10 @@ def summarize(inp,file=None):
176
  print (f'out:: {out}')
177
  #history += "observation: the search results are:\n {}\n".format(out)
178
  task = "complete?"
179
- return rawp
180
  #################################
181
 
182
-
183
  examples =[
184
  "what are todays breaking news stories?",
185
  "find the most popular model that I can use to generate an image by providing a text prompt",
@@ -202,15 +203,20 @@ with gr.Blocks() as app:
202
  gr.File()
203
  '''
204
  with gr.Blocks() as app:
 
205
  with gr.Row():
206
- inp_query=gr.Textbox()
207
- models_dd=gr.Dropdown(choices=[m for m in return_list],interactive=True)
 
 
 
 
208
  with gr.Row():
209
- button=gr.Button()
210
  stop_button=gr.Button("Stop")
211
- text=gr.JSON()
212
- inp_query.change(search_models,inp_query,models_dd)
213
- go=button.click(test_fn,None,text)
 
 
214
  stop_button.click(None,None,None,cancels=[go])
215
- '''
216
  app.launch(server_port=7860,show_api=False)
 
150
 
151
 
152
 
153
+ def summarize(inp,history,file=None):
154
+ history = [] if not history else history
155
  if file !=None:
156
  try:
157
  with open(file,"r") as f:
 
177
  print (f'out:: {out}')
178
  #history += "observation: the search results are:\n {}\n".format(out)
179
  task = "complete?"
180
+ return "", rawp
181
  #################################
182
 
183
+ '''
184
  examples =[
185
  "what are todays breaking news stories?",
186
  "find the most popular model that I can use to generate an image by providing a text prompt",
 
203
  gr.File()
204
  '''
205
  with gr.Blocks() as app:
206
+ chatbot = gr.Chatbot()
207
  with gr.Row():
208
+ with gr.Column(scale=3):
209
+ prompt=gr.Textbox("Instructions")
210
+ with gr.Column(scale=1):
211
+ button=gr.Button()
212
+
213
+ #models_dd=gr.Dropdown(choices=[m for m in return_list],interactive=True)
214
  with gr.Row():
 
215
  stop_button=gr.Button("Stop")
216
+ clear_btn = gr.Button("Clear")
217
+
218
+ #text=gr.JSON()
219
+ #inp_query.change(search_models,inp_query,models_dd)
220
+ go=button.click(summarize,[prompt,chatbot],[prompt,chatbot])
221
  stop_button.click(None,None,None,cancels=[go])
 
222
  app.launch(server_port=7860,show_api=False)