sadidul012 commited on
Commit
c60061d
·
1 Parent(s): 71d6ac3
Files changed (2) hide show
  1. app.py +4 -0
  2. test.py +13 -7
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import os
2
  from dotenv import load_dotenv
3
  from scrapegraphai.graphs import SmartScraperGraph
@@ -32,6 +33,9 @@ graph_config = {
32
 
33
 
34
  def scrape_and_summarize(prompt, source):
 
 
 
35
  return {"prompt": prompt}, {"source": source}
36
  # smart_scraper_graph = SmartScraperGraph(
37
  # prompt=prompt,
 
1
+ import html
2
  import os
3
  from dotenv import load_dotenv
4
  from scrapegraphai.graphs import SmartScraperGraph
 
33
 
34
 
35
  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,
test.py CHANGED
@@ -1,9 +1,15 @@
1
  from gradio_client import Client
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
- client = Client("sadidul012/test-space")
4
- result = client.predict(
5
- prompt="List me all the press releases with their headlines and urls.",
6
- source="html",
7
- api_name="/scrape_and_summarize"
8
- )
9
- print(result)
 
1
  from gradio_client import Client
2
+ import html
3
+
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