Update app.py
Browse files
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.
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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()
|