Spaces:
Runtime error
Runtime error
File size: 714 Bytes
c5b702e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
"""
Gradio Twitter analizer application.
This module provides a gradio-based web application
for the Twitter analyzer project.
"""
import gradio as gr
from tweet_scraper import retrieve_tweet_text
from backend import predict_positivity
def process_tweet(url: str) -> str:
"""
Get a tweet's positivity.
Args:
url (str): Tweet's URL.
Returns:
str: Predicted positivity
"""
text = retrieve_tweet_text(url)
outcome = predict_positivity(text)
return outcome
app = gr.Interface(
fn=process_tweet,
inputs=gr.inputs.Textbox(lines=2, placeholder="Tweet url..."),
outputs="text",
)
if __name__ == "__main__":
app, local_url, share_url = app.launch()
|