Spaces:
Sleeping
Sleeping
File size: 620 Bytes
23d5121 ae7e6cc 23d5121 ae7e6cc 23d5121 ae7e6cc |
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 |
import os
import gradio as gr
from openai import OpenAI
client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
def fetch_positive_news():
response = client.responses.create(
model="gpt-4o",
input="What was a positive news story that happened today?",
tools=[{"type": "web_search"}]
)
return response.output_text
demo = gr.Interface(
fn=fetch_positive_news,
inputs=None,
outputs="text",
title="Daily Positive News",
description="Click the button to fetch a positive news story from today using OpenAI's Responses API.",
allow_flagging="never"
)
demo.launch()
|