sadidul012 commited on
Commit
490ea78
·
1 Parent(s): c60061d
Files changed (2) hide show
  1. app.py +10 -9
  2. test.py +7 -8
app.py CHANGED
@@ -36,15 +36,16 @@ def scrape_and_summarize(prompt, source):
36
  with open("file.txt", "w") as file:
37
  file.write(html.unescape(source))
38
 
39
- return {"prompt": prompt}, {"source": source}
40
- # smart_scraper_graph = SmartScraperGraph(
41
- # prompt=prompt,
42
- # source=source,
43
- # config=graph_config
44
- # )
45
- # result = smart_scraper_graph.run()
46
- # exec_info = smart_scraper_graph.get_execution_info()
47
- # return result, prettify_exec_info(exec_info)
 
48
 
49
 
50
  # Gradio interface
 
36
  with open("file.txt", "w") as file:
37
  file.write(html.unescape(source))
38
 
39
+ # return {"prompt": prompt}, {"source": source}
40
+ smart_scraper_graph = SmartScraperGraph(
41
+ prompt=prompt,
42
+ source="file.txt",
43
+ # source=source,
44
+ config=graph_config
45
+ )
46
+ result = smart_scraper_graph.run()
47
+ exec_info = smart_scraper_graph.get_execution_info()
48
+ return result, prettify_exec_info(exec_info)
49
 
50
 
51
  # Gradio interface
test.py CHANGED
@@ -4,12 +4,11 @@ import html
4
  with open("/home/sadid-dl/html.txt", "r") as file:
5
  text = file.read()
6
 
7
- # client = Client("sadidul012/test-space")
8
- # result = client.predict(
9
- # prompt="List me all the press releases with their headlines and urls.",
10
- # source=html.escape(text),
11
- # api_name="/scrape_and_summarize"
12
- # )
13
- # print(result)
14
- text = html.escape(text)
15
 
 
4
  with open("/home/sadid-dl/html.txt", "r") as file:
5
  text = file.read()
6
 
7
+ client = Client("sadidul012/test-space")
8
+ result = client.predict(
9
+ prompt="List me all the press releases with their headlines and urls.",
10
+ source=html.escape(text),
11
+ api_name="/scrape_and_summarize"
12
+ )
13
+ print(result)
 
14