raj999 commited on
Commit
b6d84ef
·
verified ·
1 Parent(s): 9625bf1

Update app.py

Browse files

correction to upload

Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -68,6 +68,9 @@ def respond(
68
  # Return the model's response
69
  return response['answer']
70
 
 
 
 
71
 
72
  # Gradio interface setup
73
  demo = gr.Blocks()
@@ -78,7 +81,11 @@ with demo:
78
  doc_input = gr.Textbox(
79
  lines=10, placeholder="Enter your documents here, one per line.", label="Input Documents"
80
  )
81
- upload_button = gr.Button("Upload Documents")
 
 
 
 
82
 
83
  with gr.Row():
84
  # Chat interface for the RAG system
 
68
  # Return the model's response
69
  return response['answer']
70
 
71
+ def upload_file(filepath):
72
+ name = Path(filepath).name
73
+ return [gr.UploadButton(visible=False), gr.DownloadButton(label=f"Download {name}", value=filepath, visible=True)]
74
 
75
  # Gradio interface setup
76
  demo = gr.Blocks()
 
81
  doc_input = gr.Textbox(
82
  lines=10, placeholder="Enter your documents here, one per line.", label="Input Documents"
83
  )
84
+ # upload_button = gr.Button("Upload Documents")
85
+ with gr.Row():
86
+ u = gr.UploadButton("Upload a file", file_count="single")
87
+ u.upload(upload_file, u, [u, d])
88
+
89
 
90
  with gr.Row():
91
  # Chat interface for the RAG system