Spaces:
Runtime error
Runtime error
Staticaliza
commited on
Commit
•
3404bde
1
Parent(s):
59e2bc1
Update app.py
Browse files
app.py
CHANGED
@@ -34,6 +34,12 @@ def predict(access_key, token, image, instructions, pre_input, input, seed = 42)
|
|
34 |
print(">>> MODEL FAILED: Input: " + input + ", Attempted Key: " + access_key)
|
35 |
return ("[UNAUTHORIZED ACCESS]", input, []);
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
formatted_input = instructions.replace(symbol, pre_input) + pre_input + input + "![](https://statical-stc-itt.hf.space/file=" + image + ")<end_of_utterance>\nAssistant:"
|
38 |
model = InferenceClient(model_endpoint, headers = { "Authorization": f"Bearer {token}" })
|
39 |
response = model.text_generation(
|
|
|
34 |
print(">>> MODEL FAILED: Input: " + input + ", Attempted Key: " + access_key)
|
35 |
return ("[UNAUTHORIZED ACCESS]", input, []);
|
36 |
|
37 |
+
if len(instructions.strip()) <= 0:
|
38 |
+
instructions = default_instructions
|
39 |
+
|
40 |
+
if len(pre_input.strip()) <= 0:
|
41 |
+
pre_input = default_pre_text
|
42 |
+
|
43 |
formatted_input = instructions.replace(symbol, pre_input) + pre_input + input + "![](https://statical-stc-itt.hf.space/file=" + image + ")<end_of_utterance>\nAssistant:"
|
44 |
model = InferenceClient(model_endpoint, headers = { "Authorization": f"Bearer {token}" })
|
45 |
response = model.text_generation(
|