Update app.py
Browse files
app.py
CHANGED
@@ -48,15 +48,15 @@ def process_pdf_upload(api_key, pdf_file):
|
|
48 |
vectordb = load_and_process_pdf(pdf_file, api_key)
|
49 |
if isinstance(vectordb, str):
|
50 |
return vectordb
|
51 |
-
return "
|
52 |
|
53 |
# δΈ»η¨εΌ - Gradio δ»ι’
|
54 |
with gr.Blocks() as demo:
|
55 |
-
gr.Markdown("## π
|
56 |
|
57 |
with gr.Row():
|
58 |
api_key = gr.Textbox(label="π θ«θΌΈε
₯ζ¨η OpenAI API Key", type="password")
|
59 |
-
pdf_file = gr.File(label="π δΈε³ PDF
|
60 |
|
61 |
chatbot = gr.Chatbot(label="π¬ θ倩ε")
|
62 |
state = gr.State([])
|
@@ -71,7 +71,7 @@ with gr.Blocks() as demo:
|
|
71 |
|
72 |
def handle_user_input(api_key, user_message, chat_history):
|
73 |
if not vectordb:
|
74 |
-
return chat_history, "θ«ε
δΈε³ PDF
|
75 |
if user_message.strip().lower() == "θ¬θ¬":
|
76 |
return chat_history, "ε ζ²Ή~~~"
|
77 |
return handle_query(api_key, user_message, vectordb, chat_history)
|
|
|
48 |
vectordb = load_and_process_pdf(pdf_file, api_key)
|
49 |
if isinstance(vectordb, str):
|
50 |
return vectordb
|
51 |
+
return "ι£θε·²ζεθΌε
₯οΌθ«ιε§ι»θγ"
|
52 |
|
53 |
# δΈ»η¨εΌ - Gradio δ»ι’
|
54 |
with gr.Blocks() as demo:
|
55 |
+
gr.Markdown("## π ει倧ε»ζδ½ εθ ")
|
56 |
|
57 |
with gr.Row():
|
58 |
api_key = gr.Textbox(label="π θ«θΌΈε
₯ζ¨η OpenAI API Key", type="password")
|
59 |
+
pdf_file = gr.File(label="π δΈε³ PDF ι£θ", file_types=[".pdf"])
|
60 |
|
61 |
chatbot = gr.Chatbot(label="π¬ θ倩ε")
|
62 |
state = gr.State([])
|
|
|
71 |
|
72 |
def handle_user_input(api_key, user_message, chat_history):
|
73 |
if not vectordb:
|
74 |
+
return chat_history, "θ«ε
δΈε³ PDF ι£θγ"
|
75 |
if user_message.strip().lower() == "θ¬θ¬":
|
76 |
return chat_history, "ε ζ²Ή~~~"
|
77 |
return handle_query(api_key, user_message, vectordb, chat_history)
|