Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -24,34 +24,14 @@ For posts about tools and libraries, return "tools_libraries"
|
|
24 |
For posts containing tutorials and guides, return "tutorials_guides"
|
25 |
For posts about debugging and problem-solving, return "debugging"
|
26 |
Respond only with the category name, without any additional explanation or text.
|
27 |
-
|
28 |
user
|
29 |
{pl7_text}
|
30 |
-
|
31 |
assistant
|
32 |
'''
|
33 |
})
|
34 |
|
35 |
-
print("API Response:", output) # Print the full API response
|
36 |
-
|
37 |
if isinstance(output, list) and len(output) > 0:
|
38 |
-
generated_text = output[0].get('generated_text', '')
|
39 |
-
print("Generated Text:", generated_text) # Print the generated text
|
40 |
-
|
41 |
-
# Extract the response after the last 'assistant' keyword
|
42 |
-
parts = generated_text.split('assistant\n')
|
43 |
-
if len(parts) > 1:
|
44 |
-
return parts[-1].strip().lower() # Extract the text after the last 'assistant'
|
45 |
-
return "unknown"
|
46 |
|
47 |
-
|
48 |
-
custom_post_content = """
|
49 |
-
This is a sample post about fine-tuning models for specific tasks.
|
50 |
-
It discusses various techniques and best practices for adjusting models.
|
51 |
-
"""
|
52 |
|
53 |
-
print("
|
54 |
-
print(custom_post_content)
|
55 |
-
print("\nAnalyzing sentiment...")
|
56 |
-
sentiment = analyze_sentiment(custom_post_content)
|
57 |
-
print(f"\nSentiment category: {sentiment}")
|
|
|
24 |
For posts containing tutorials and guides, return "tutorials_guides"
|
25 |
For posts about debugging and problem-solving, return "debugging"
|
26 |
Respond only with the category name, without any additional explanation or text.
|
|
|
27 |
user
|
28 |
{pl7_text}
|
|
|
29 |
assistant
|
30 |
'''
|
31 |
})
|
32 |
|
|
|
|
|
33 |
if isinstance(output, list) and len(output) > 0:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
+
generated_text = output[0].get('generated_text', '').strip().lower()
|
|
|
|
|
|
|
|
|
36 |
|
37 |
+
print("Generated Text:", generated_text) # Print the generated text
|
|
|
|
|
|
|
|