Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,8 @@ import gradio as gr
|
|
7 |
from docx import Document
|
8 |
from PyPDF2 import PdfFileReader
|
9 |
import re
|
|
|
|
|
10 |
|
11 |
# Set OpenAI API key from environment variable
|
12 |
openai.api_key = os.environ["Secret"]
|
@@ -114,9 +116,8 @@ def predict(message, history, file_obj=None):
|
|
114 |
yield partial_message
|
115 |
|
116 |
# Modify the Gradio interface to include the file upload component
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
|
|
|
7 |
from docx import Document
|
8 |
from PyPDF2 import PdfFileReader
|
9 |
import re
|
10 |
+
from gradio import Interface, components
|
11 |
+
|
12 |
|
13 |
# Set OpenAI API key from environment variable
|
14 |
openai.api_key = os.environ["Secret"]
|
|
|
116 |
yield partial_message
|
117 |
|
118 |
# Modify the Gradio interface to include the file upload component
|
119 |
+
Interface(fn=predict,
|
120 |
+
inputs=["text", "list", components.File(label="Upload PDF or DOCX file")],
|
121 |
+
outputs="textbox", # Using "textbox" as a replacement for "chat"
|
122 |
+
live=True).launch()
|
|
|
123 |
|