Update app.py
Browse files
app.py
CHANGED
@@ -1,50 +1,16 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
-
from instapy import InstaPy
|
3 |
-
import time
|
4 |
|
|
|
|
|
5 |
|
|
|
|
|
6 |
|
7 |
-
def
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
11 |
|
12 |
-
|
13 |
-
# Enable story interaction
|
14 |
-
session.set_do_story(enabled=True, percentage=100)
|
15 |
-
session.set_do_comment(enabled=True, percentage=100) # Enable commenting
|
16 |
-
# Customize comments
|
17 |
-
session.set_comments(
|
18 |
-
["Nice!", "نام من فرید است و سلام به شما امیدوارم موفق باشید", "Amazing!", "🔥", "Hello My Name Is Farid :)...", "کارت عالی بود", "تو بهترینی", "اطلاعات شگفت انگیز"])
|
19 |
-
|
20 |
-
# Log in
|
21 |
-
session.login()
|
22 |
-
|
23 |
-
while True:
|
24 |
-
# Like stories
|
25 |
-
session.like_stories(amount=10) # Like 10 stories (adjust as needed)
|
26 |
-
|
27 |
-
# Reply to stories
|
28 |
-
session.reply_to_stories(["👍", "🔥"]) # Customize your replies
|
29 |
-
|
30 |
-
# Gain followers
|
31 |
-
# Follow followers of specific users
|
32 |
-
session.follow_user_followers(
|
33 |
-
["demon_bakemon", "asma__a1997"], amount=5, randomize=True)
|
34 |
-
|
35 |
-
# Wait for 1 minute before the next iteration
|
36 |
-
time.sleep(60)
|
37 |
-
|
38 |
-
|
39 |
-
return "Instagram bot started! It will like stories, leave comments, gain followers, and run every minute."
|
40 |
-
|
41 |
-
|
42 |
-
iface = gr.Interface(
|
43 |
-
fn=trigger_instagram_bot,
|
44 |
-
inputs=None,
|
45 |
-
outputs=gr.outputs.Textbox(label="Bot Status"),
|
46 |
-
title="Instagram Bot: Auto Like, Comment, Follow & Schedule",
|
47 |
-
description="Click the button to start the extended bot!",
|
48 |
-
)
|
49 |
-
|
50 |
-
iface.launch()
|
|
|
1 |
+
from transformers import pipeline
|
2 |
import gradio as gr
|
|
|
|
|
3 |
|
4 |
+
# Load a pre-trained chatbot model
|
5 |
+
chatbot = pipeline("conversational")
|
6 |
|
7 |
+
def wrap(x):
|
8 |
+
return textwrap.fill(x, replace_whitespace=False, fix_sentence_endings=True)
|
9 |
|
10 |
+
def chat(prompt):
|
11 |
+
out = chatbot(prompt)
|
12 |
+
for i in wrap(out[0]['generated_text']):
|
13 |
+
print(i, end='')
|
14 |
+
time.sleep(0.2)
|
15 |
|
16 |
+
gr.Interface(fn=chat, inputs="text", outputs="text").launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|