manuelcozar55 commited on
Commit
ba072b0
1 Parent(s): 4695961

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -12
app.py CHANGED
@@ -51,15 +51,19 @@ def generate(mode, file, file_type, instructions, history, temperature=0.9, max_
51
  yield output
52
  return output
53
 
54
- gr.ChatInterface(
55
- fn=generate,
56
- inputs=[
57
- gr.Dropdown(label="Mode", choices=["translation", "summary", "explanation"], value="translation"),
58
- gr.File(label="Input File", type="filepath"),
59
- gr.Radio(label="File Type", choices=["pdf", "json"], value="pdf"),
60
- gr.Textbox(label="Additional Instructions", placeholder="Enter any additional instructions here"),
61
- gr.Chatbot()
62
- ],
63
- outputs=gr.Chatbot(),
64
- title="Mistral 7B v0.3"
65
- ).launch(show_api=False)
 
 
 
 
 
51
  yield output
52
  return output
53
 
54
+ with gr.Blocks() as demo:
55
+ mode = gr.Dropdown(label="Mode", choices=["translation", "summary", "explanation"], value="translation")
56
+ file = gr.File(label="Input File", type="file")
57
+ file_type = gr.Radio(label="File Type", choices=["pdf", "json"], value="pdf")
58
+ instructions = gr.Textbox(label="Additional Instructions", placeholder="Enter any additional instructions here")
59
+ chatbot = gr.Chatbot()
60
+
61
+ def update_chatbot(mode, file, file_type, instructions, history):
62
+ return generate(mode, file, file_type, instructions, history)
63
+
64
+ gr.Interface(
65
+ fn=update_chatbot,
66
+ inputs=[mode, file, file_type, instructions, chatbot],
67
+ outputs=chatbot,
68
+ title="Mistral 7B v0.3"
69
+ ).launch()