"""Serve static files with CORS headers""" | |
import gradio as gr | |
from pathlib import Path | |
import json | |
def serve_conversations(): | |
"""Serve conversations.json with proper CORS headers""" | |
try: | |
with open('conversations.json', 'r') as f: | |
data = json.load(f) | |
return gr.JSON(data, headers={ | |
"Access-Control-Allow-Origin": "*", | |
"Access-Control-Allow-Methods": "GET", | |
"Access-Control-Allow-Headers": "Content-Type" | |
}) | |
except: | |
return {"error": "File not found"} |