Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -161,12 +161,6 @@ Digital: Note the software used, shading techniques, and multimedia approaches."
|
|
| 161 |
stream=False,
|
| 162 |
)
|
| 163 |
enhanced = chat_completion.choices[0].message.content
|
| 164 |
-
# Truncate to 77 tokens if still too long
|
| 165 |
-
tokenizer = CLIPTokenizer.from_pretrained("openai/clip-vit-large-patch14")
|
| 166 |
-
tokens = tokenizer.tokenize(enhanced)
|
| 167 |
-
if len(tokens) > 77:
|
| 168 |
-
tokens = tokens[:77]
|
| 169 |
-
enhanced = tokenizer.convert_tokens_to_string(tokens)
|
| 170 |
except Exception as e:
|
| 171 |
enhanced = f"Error enhancing prompt: {str(e)}"
|
| 172 |
return enhanced
|
|
|
|
| 161 |
stream=False,
|
| 162 |
)
|
| 163 |
enhanced = chat_completion.choices[0].message.content
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
except Exception as e:
|
| 165 |
enhanced = f"Error enhancing prompt: {str(e)}"
|
| 166 |
return enhanced
|