Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import json
|
3 |
+
|
4 |
+
# Eğitim verisini yükle
|
5 |
+
with open("memory_questions.json", "r") as f:
|
6 |
+
memory_data = json.load(f)
|
7 |
+
|
8 |
+
# Soru tahmini fonksiyonu
|
9 |
+
def generate_question(memory: str):
|
10 |
+
# En yakın eşleşmeyi manuel kurarak (örnek amaçlı)
|
11 |
+
for item in memory_data:
|
12 |
+
if item['description'].lower() in memory.lower():
|
13 |
+
return item['question']
|
14 |
+
return "What question does this memory bring to your mind?"
|
15 |
+
|
16 |
+
# Gradio UI
|
17 |
+
iface = gr.Interface(
|
18 |
+
fn=generate_question,
|
19 |
+
inputs=gr.Textbox(label="Your Memory"),
|
20 |
+
outputs=gr.Textbox(label="Generated Question"),
|
21 |
+
title="MemoRease Question Generator"
|
22 |
+
)
|
23 |
+
|
24 |
+
iface.launch()
|