IProject-10 commited on
Commit
c0de0f6
Β·
verified Β·
1 Parent(s): 4fdeec5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -113,22 +113,21 @@ def process_webpage_and_load(url):
113
  with gr.Blocks() as demo:
114
  gr.Markdown("## πŸ€– Chat with LLaMA Webpage Content")
115
 
116
- with gr.Row():
117
- url_input = gr.Textbox(label="🌐 Webpage URL", placeholder="Enter a Wikipedia or article URL")
118
- load_btn = gr.Button("Load Webpage")
119
-
120
  with gr.Row():
121
  chatbot = gr.Chatbot(label="Chat History")
122
 
123
  with gr.Row():
124
- question = gr.Textbox(label="Ask your question about the webpage", placeholder="e.g., Who developed LLaMA?")
 
 
 
125
  ask_btn = gr.Button("Submit")
126
  clear_btn = gr.Button("Clear Chat")
127
 
128
  summary_output = gr.Textbox(label="πŸ“‹ Summary of the Webpage", lines=8)
129
  summarize_btn = gr.Button("Summarize Content")
130
 
131
- # Function bindings
132
  def user_chat_handler(q, history):
133
  response = chat_with_bot(q)
134
  history.append((q, response))
@@ -137,6 +136,6 @@ with gr.Blocks() as demo:
137
  ask_btn.click(fn=user_chat_handler, inputs=[question, chatbot], outputs=[chatbot, question])
138
  clear_btn.click(lambda: [], None, chatbot)
139
  summarize_btn.click(fn=summarize_content, inputs=[], outputs=summary_output)
140
- load_btn.click(fn=process_webpage_and_load, inputs=[url_input], outputs=[summary_output])
141
 
142
  demo.launch()
 
 
113
  with gr.Blocks() as demo:
114
  gr.Markdown("## πŸ€– Chat with LLaMA Webpage Content")
115
 
 
 
 
 
116
  with gr.Row():
117
  chatbot = gr.Chatbot(label="Chat History")
118
 
119
  with gr.Row():
120
+ question = gr.Textbox(
121
+ label="Ask your question about LLaMA",
122
+ placeholder="e.g., Who developed LLaMA?"
123
+ )
124
  ask_btn = gr.Button("Submit")
125
  clear_btn = gr.Button("Clear Chat")
126
 
127
  summary_output = gr.Textbox(label="πŸ“‹ Summary of the Webpage", lines=8)
128
  summarize_btn = gr.Button("Summarize Content")
129
 
130
+ # Button logic
131
  def user_chat_handler(q, history):
132
  response = chat_with_bot(q)
133
  history.append((q, response))
 
136
  ask_btn.click(fn=user_chat_handler, inputs=[question, chatbot], outputs=[chatbot, question])
137
  clear_btn.click(lambda: [], None, chatbot)
138
  summarize_btn.click(fn=summarize_content, inputs=[], outputs=summary_output)
 
139
 
140
  demo.launch()
141
+