Ubik80's picture
Updated Fake News Detective with Gradio and SmolAgents
9c881b4
raw
history blame
715 Bytes
import gradio as gr
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel
# Inizializza il modello e l'agente
search_tool = DuckDuckGoSearchTool()
model = HfApiModel()
agent = CodeAgent(model=model, tools=[search_tool])
# Funzione per analizzare le notizie
def detect_fake_news(news_text):
response = agent.run(f"Check if this news is true or fake: {news_text}")
return response
# Configurazione di Gradio
interface = gr.Interface(
fn=detect_fake_news,
inputs="text",
outputs="text",
title="🕵️ Fake News Detective",
description="Paste a news article or statement and get a credibility analysis."
)
# Avvio dell'app
if __name__ == "__main__":
interface.launch()