Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| import hopsworks | |
| from datasets import load_dataset | |
| import numpy as np | |
| import pandas as pd | |
| project = hopsworks.login() | |
| fs = project.get_feature_store() | |
| dataset_api = project.get_dataset_api() | |
| dataset_api.download("Resources/batch_data_predictions.csv") | |
| dataset = load_dataset("csv", data_files="batch_data_predictions.csv") | |
| predictions_df = pd.DataFrame(dataset,columns=['Headlines', 'URL','Predictions'],) | |
| predictions_df_url = predictions_df['URL'] | |
| def article_selection(sentiment): | |
| if sentiment == "Positive": | |
| return predictions_df_url #f"""The sentence you requested is Positive!""" | |
| #elif sentiment == "Negative": | |
| # return f"""The sentence you requested is Negative!""" | |
| #else: | |
| # return f"""The sentence you requested is Neutral!""" | |
| demo = gr.Interface( | |
| fn=article_selection, | |
| inputs = gr.Dropdown(["Positive","Negative","Neutral"], label="What type of news articles would you like recommended?"), | |
| outputs = [gr.Textbox(label="Sentiment of News Articles")], | |
| ) | |
| #TODO | |
| #demo = gr.TabbedInterface([url_demo, voice_demo], ["Swedish YouTube Video to English Text", "Swedish Audio to English Text"]) | |
| demo.launch() |