Spaces:
Runtime error
Runtime error
Abineshkumar77 commited on
Commit ·
bcb48e9
1
Parent(s): 642ed96
Add application file
Browse files
test.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from locust import HttpUser,task,between
|
| 2 |
+
import random
|
| 3 |
+
|
| 4 |
+
tweet=["One day, a dark sorcerer named Malakar descended upon Eldoria" ,
|
| 5 |
+
"Malakar sought to plunge the world into eternal darkness" ,
|
| 6 |
+
"using a powerful artifact known as the Shadow Crystal."
|
| 7 |
+
,"The villagers were terrified, and hope seemed lost. "
|
| 8 |
+
"The king of the land sent out a call for a hero to retrieve the crystal and restore light to the world."]
|
| 9 |
+
|
| 10 |
+
class AppUser(HttpUser):
|
| 11 |
+
wait_time=between(2,5)
|
| 12 |
+
|
| 13 |
+
@task
|
| 14 |
+
def home(self):
|
| 15 |
+
self.client.get("/")
|
| 16 |
+
|
| 17 |
+
@task
|
| 18 |
+
def analyze_sentiment(self):
|
| 19 |
+
mytweet=random.choice(tweet)
|
| 20 |
+
self.client.get("/analyze"+str(mytweet))
|