Spaces:
Sleeping
Sleeping
Update text2generation.py
Browse files- text2generation.py +1 -7
text2generation.py
CHANGED
@@ -2,9 +2,7 @@ import os
|
|
2 |
from openai import OpenAI
|
3 |
|
4 |
def generate_educational_content(question):
|
5 |
-
"""Generate all content formats for a question"""
|
6 |
try:
|
7 |
-
# Initialize client without proxies parameter
|
8 |
client = OpenAI(
|
9 |
base_url="https://openrouter.ai/api/v1",
|
10 |
api_key=os.getenv("OPENROUTER_API_KEY")
|
@@ -20,11 +18,7 @@ def generate_educational_content(question):
|
|
20 |
Question: {question}"""
|
21 |
}],
|
22 |
temperature=0.7,
|
23 |
-
max_tokens=2000
|
24 |
-
headers={
|
25 |
-
"HTTP-Referer": "https://sreepathi-ravikumar-backendprocess.hf.space",
|
26 |
-
"X-Title": "Educational AI Assistant"
|
27 |
-
}
|
28 |
)
|
29 |
detailed_answer = detailed_response.choices[0].message.content
|
30 |
|
|
|
2 |
from openai import OpenAI
|
3 |
|
4 |
def generate_educational_content(question):
|
|
|
5 |
try:
|
|
|
6 |
client = OpenAI(
|
7 |
base_url="https://openrouter.ai/api/v1",
|
8 |
api_key=os.getenv("OPENROUTER_API_KEY")
|
|
|
18 |
Question: {question}"""
|
19 |
}],
|
20 |
temperature=0.7,
|
21 |
+
max_tokens=2000
|
|
|
|
|
|
|
|
|
22 |
)
|
23 |
detailed_answer = detailed_response.choices[0].message.content
|
24 |
|