|
import gradio as gr |
|
from utils import get_comments, get_users_from_keyword |
|
|
|
with gr.Blocks() as iface1: |
|
with gr.Row(): |
|
input_url =gr.Textbox(label="Instagram URL") |
|
search = gr.Button("Search") |
|
output_component = gr.Dataframe(headers=['username','comment_text','user_is_verfied','user_is_private', 'commment_like_count']) |
|
search.click(fn=get_comments, inputs=input_url, outputs=output_component,api_name="search_function") |
|
|
|
|
|
with gr.Blocks() as iface2: |
|
with gr.Row(): |
|
input_url =gr.Textbox(label="Keyword") |
|
search = gr.Button("Search") |
|
output_component = gr.Dataframe(headers=['username','is_verified']) |
|
search.click(fn=get_users_from_keyword, inputs=input_url, outputs=output_component,api_name="search_function") |
|
|
|
|
|
|
|
demo = gr.TabbedInterface([iface1, iface2], [ |
|
"Instagram comment extractor", "Instagram user keyword search"], |
|
title = "Instagram scraping tool") |
|
|
|
demo.launch(share=True) |
|
|