:recycle: take refering url from the gradio environment
Browse files
app.py
CHANGED
@@ -97,7 +97,7 @@ initial_model = NEMOTRON
|
|
97 |
|
98 |
REFLECTION_SYSTEM_PROMPT = """You are a world-class AI system, capable of complex reasoning and reflection. Reason through the query inside <thinking> tags, and then provide your final response inside <output> tags. If you detect that you made a mistake in your reasoning at any point, correct yourself inside <reflection> tags."""
|
99 |
|
100 |
-
def respond(message, history, model):
|
101 |
# insist on that model is in model_choices
|
102 |
if not model_in_list(model):
|
103 |
raise RuntimeError(f"{model} is not supported in this hf space. Visit https://featherless.ai to see and use the complete model catalogue")
|
@@ -121,7 +121,7 @@ def respond(message, history, model):
|
|
121 |
stream=True,
|
122 |
max_tokens=2000,
|
123 |
extra_headers={
|
124 |
-
'HTTP-Referer':
|
125 |
'X-Title': "HF's missing inference widget"
|
126 |
}
|
127 |
)
|
|
|
97 |
|
98 |
REFLECTION_SYSTEM_PROMPT = """You are a world-class AI system, capable of complex reasoning and reflection. Reason through the query inside <thinking> tags, and then provide your final response inside <output> tags. If you detect that you made a mistake in your reasoning at any point, correct yourself inside <reflection> tags."""
|
99 |
|
100 |
+
def respond(message, history, model, request: gr.Request):
|
101 |
# insist on that model is in model_choices
|
102 |
if not model_in_list(model):
|
103 |
raise RuntimeError(f"{model} is not supported in this hf space. Visit https://featherless.ai to see and use the complete model catalogue")
|
|
|
121 |
stream=True,
|
122 |
max_tokens=2000,
|
123 |
extra_headers={
|
124 |
+
'HTTP-Referer': request.headers.get('referer'),
|
125 |
'X-Title': "HF's missing inference widget"
|
126 |
}
|
127 |
)
|