cagrioner commited on
Commit
bfc5a61
·
1 Parent(s): cbf22b4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -9
app.py CHANGED
@@ -1,13 +1,22 @@
1
  import gradio as gr
2
- import metadata_parser
3
- import pandas as pd
4
-
5
-
6
- link = "https://www.oggusto.com/gastronomi/turkiye/destek-olabileceginiz-yerel-ureticiler"
7
-
8
 
9
  def parse(link):
10
  page = metadata_parser.MetadataParser(url=link)
11
- return page.metadata
12
- iface = gr.Interface(fn=parse, inputs="text", outputs="text")
13
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ import metadata_parse
 
 
 
 
 
3
 
4
  def parse(link):
5
  page = metadata_parser.MetadataParser(url=link)
6
+ title = page.get_metadatas('title')[0]
7
+ description = page.get_metadatas('description')[0]
8
+ image = page.get_metadata_link('image')
9
+ metadata = page.metadata
10
+ return title, description, image, metadata
11
+
12
+ with gr.Blocks() as demo:
13
+ link = gr.Textbox(label="Bağlantı")
14
+ output1 = gr.Textbox( label="Başlık")
15
+ output2 = gr.Textbox(label="Açıklama")
16
+ output3 = gr.Textbox(label="Görsel")
17
+ output4 = gr.Textbox(label="Metadata")
18
+
19
+ greet_btn = gr.Button("Gönder")
20
+ greet_btn.click(fn=parse, inputs=link, outputs=[output1,output2, output3, output4])
21
+
22
+ demo.launch()