sadidul012 commited on
Commit
b0c4c14
1 Parent(s): 9139aeb

File input test

Browse files
Files changed (2) hide show
  1. app.py +18 -12
  2. packages.txt +1 -1
app.py CHANGED
@@ -32,14 +32,15 @@ graph_config = {
32
 
33
 
34
  def scrape_and_summarize(prompt, source):
35
- smart_scraper_graph = SmartScraperGraph(
36
- prompt=prompt,
37
- source=source,
38
- config=graph_config
39
- )
40
- result = smart_scraper_graph.run()
41
- exec_info = smart_scraper_graph.get_execution_info()
42
- return result, prettify_exec_info(exec_info)
 
43
 
44
 
45
  # Gradio interface
@@ -52,9 +53,9 @@ with gr.Blocks() as demo:
52
  with gr.Row():
53
  with gr.Column():
54
  model_dropdown = gr.Textbox(label="Model", value="Mistral-7B-Instruct-v0.2")
55
- prompt_input = gr.Textbox(label="Prompt",
56
- value="List me all the press releases with their headlines and urls.")
57
- source_input = gr.Textbox(label="Source URL", value="https://www.whitehouse.gov/")
58
  scrape_button = gr.Button("Scrape and Summarize")
59
 
60
  with gr.Column():
@@ -63,10 +64,15 @@ with gr.Blocks() as demo:
63
 
64
  scrape_button.click(
65
  scrape_and_summarize,
66
- inputs=[prompt_input, source_input],
67
  outputs=[result_output, exec_info_output]
68
  )
69
 
 
 
 
 
 
70
  # Launch the Gradio app
71
  if __name__ == "__main__":
72
  demo.launch()
 
32
 
33
 
34
  def scrape_and_summarize(prompt, source):
35
+ return source.name, prompt
36
+ # smart_scraper_graph = SmartScraperGraph(
37
+ # prompt=prompt,
38
+ # source=source,
39
+ # config=graph_config
40
+ # )
41
+ # result = smart_scraper_graph.run()
42
+ # exec_info = smart_scraper_graph.get_execution_info()
43
+ # return result, prettify_exec_info(exec_info)
44
 
45
 
46
  # Gradio interface
 
53
  with gr.Row():
54
  with gr.Column():
55
  model_dropdown = gr.Textbox(label="Model", value="Mistral-7B-Instruct-v0.2")
56
+ prompt_input = gr.Textbox(label="Prompt", value="List me all the press releases with their headlines and urls.")
57
+ # source_input = gr.Textbox(label="Source URL", value="https://www.whitehouse.gov/")
58
+ file_input = gr.Interface(inputs=["file",], outputs="text")
59
  scrape_button = gr.Button("Scrape and Summarize")
60
 
61
  with gr.Column():
 
64
 
65
  scrape_button.click(
66
  scrape_and_summarize,
67
+ inputs=[prompt_input, file_input],
68
  outputs=[result_output, exec_info_output]
69
  )
70
 
71
+ # def process_file(fileobj):
72
+ # file_path = fileobj.name
73
+ # return do_something(file_path)
74
+
75
+
76
  # Launch the Gradio app
77
  if __name__ == "__main__":
78
  demo.launch()
packages.txt CHANGED
@@ -5,4 +5,4 @@ libatk-bridge2.0-0
5
  libcups2
6
  libatspi2.0-0
7
  libxcomposite1
8
- libxdamage1
 
5
  libcups2
6
  libatspi2.0-0
7
  libxcomposite1
8
+ libxdamage1