Omnibus commited on
Commit
fa221ab
·
1 Parent(s): d87354d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -42
app.py CHANGED
@@ -46,27 +46,10 @@ def read_pdf(pdf_path):
46
  print (text)
47
  return text
48
 
49
- def parse_action(string: str):
50
- print("PARSING:")
51
- print(string)
52
- assert string.startswith("action:")
53
- idx = string.find("action_input=")
54
- print(idx)
55
- if idx == -1:
56
- print ("idx == -1")
57
- print (string[8:])
58
- return string[8:], None
59
-
60
- print ("last return:")
61
- print (string[8 : idx - 1])
62
- print (string[idx + 13 :].strip("'").strip('"'))
63
- return string[8 : idx - 1], string[idx + 13 :].strip("'").strip('"')
64
-
65
-
66
 
67
  VERBOSE = True
68
  MAX_HISTORY = 100
69
- MAX_DATA = 20000
70
 
71
  def format_prompt(message, history):
72
  prompt = "<s>"
@@ -218,29 +201,9 @@ def summarize(inp,history,data=None,file=None):
218
  yield "", history
219
  #################################
220
 
221
- '''
222
- examples =[
223
- "what are todays breaking news stories?",
224
- "find the most popular model that I can use to generate an image by providing a text prompt",
225
- "return the top 10 models that I can use to identify objects in images",
226
- "which models have the most likes from each category?",
227
- ]
228
- additional_inputs=[
229
- gr.File(),
230
- ]
231
- with gr.Blocks() as app:
232
- with gr.Row():
233
- gr.ChatInterface(
234
- fn=summarize,
235
- chatbot=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, likeable=True, layout="panel"),
236
- title="<center>Mixtral 8x7B TLDR</center>",
237
- description="<center>Summarize Lengthy data with<br>Mixtral 8x7B",
238
- examples=examples,
239
- concurrency_limit=20,
240
- )
241
- gr.File()
242
- '''
243
  with gr.Blocks() as app:
 
244
  chatbot = gr.Chatbot()
245
  with gr.Row():
246
  with gr.Column(scale=3):
@@ -253,8 +216,8 @@ with gr.Blocks() as app:
253
  stop_button=gr.Button("Stop")
254
  clear_btn = gr.Button("Clear")
255
  with gr.Row():
256
- data=gr.Textbox(label="Input Data", lines=6)
257
- file=gr.File(label="Input File")
258
  #text=gr.JSON()
259
  #inp_query.change(search_models,inp_query,models_dd)
260
  go=button.click(summarize,[prompt,chatbot,data,file],[prompt,chatbot])
 
46
  print (text)
47
  return text
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
  VERBOSE = True
51
  MAX_HISTORY = 100
52
+ MAX_DATA = 25000
53
 
54
  def format_prompt(message, history):
55
  prompt = "<s>"
 
201
  yield "", history
202
  #################################
203
 
204
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205
  with gr.Blocks() as app:
206
+ gr.HTML("""<center><h1>Mixtral 8x7b TLDR Summarizer</h1><h3>Summarize Data of unlimited length</h3>""")
207
  chatbot = gr.Chatbot()
208
  with gr.Row():
209
  with gr.Column(scale=3):
 
216
  stop_button=gr.Button("Stop")
217
  clear_btn = gr.Button("Clear")
218
  with gr.Row():
219
+ data=gr.Textbox(label="Input Data (paste text)", lines=6)
220
+ file=gr.File(label="Input File (.pdf | .txt)")
221
  #text=gr.JSON()
222
  #inp_query.change(search_models,inp_query,models_dd)
223
  go=button.click(summarize,[prompt,chatbot,data,file],[prompt,chatbot])