File size: 543 Bytes
09525e7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""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"}