Spaces:
Runtime error
Runtime error
File size: 942 Bytes
b660a94 aa1c09a 421099c aa1c09a eaca1e9 c31c6cb 0000f67 b660a94 0000f67 aa1c09a b660a94 0000f67 c31c6cb 0000f67 c31c6cb 0000f67 3fd1719 0000f67 c31c6cb 0000f67 | 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 | import gradio as gr
import os
import pandas as pd
from groq import Groq
from duckduckgo_search import DDGS
from newspaper import Article
import requests
# 1. Initialize Groq Client
# Ensure GROQ_API_KEY is set in Hugging Face Secrets
client = Groq(api_key=os.environ.get("GROQ_API_KEY"))
def fetch_content(input_val):
"""Detects if input is a URL or plain text and extracts data."""
if input_val.startswith(("http://", "https://")):
try:
article = Article(input_val)
article.download()
article.parse()
return f"Title: {article.title}\n\nContent: {article.text[:2000]}"
except Exception as e:
return f"Error reading URL: {str(e)}"
return input_val
def advanced_fact_check(user_input, history):
if not user_input.strip():
return "Please provide a claim or link.", [], pd.DataFrame(history), 0
# Step A: Content Extraction
content =
|