Spaces:
Sleeping
Sleeping
File size: 1,003 Bytes
e96092e | 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 32 33 34 35 36 37 38 39 40 41 42 43 | import os
from openai import OpenAI
import gradio as gr
# Create OpenAI client
client = OpenAI()
# Function to ask the app
def ask_app(question):
try:
response = client.responses.create(
prompt={
#change this id
"id": "pmpt_69f6088a6d108197a2f121d4e4f3d5530621b9befb1a72f2",
"version": "1"
},
input=question,
reasoning={
"summary": "auto"
}
)
return response.output_text
except Exception as e:
return f"Error: {str(e)}"
# Gradio interface
demo = gr.Interface(
fn=ask_app,
inputs=gr.Textbox(
lines=3,
placeholder="Type your question here...",
label="Your Question"
),
outputs=gr.Textbox(
lines=10,
label="Answer"
),
title="DDS Cohort 10 2nd App Python Bot",
description="Ask a question and get answers from your saved prompt + vector store."
)
demo.launch(share=True) |