Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 11470ca

Browse files
Merge branch 'master' into storyScript
2 parents 562156f + 3d83095 commit 11470ca

File tree

195 files changed

+182114
-160
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

195 files changed

+182114
-160
lines changed

‎.github/FUNDING.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1 @@
1-
# These are supported funding model platforms
2-
31
github: avinashkranjan
4-
patreon: avinashkranjan
5-
open_collective: # Replace with a single Open Collective username
6-
ko_fi: avinashkranjan
7-
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8-
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9-
liberapay: # Replace with a single Liberapay username
10-
issuehunt: # Replace with a single IssueHunt username
11-
otechie: # Replace with a single Otechie username
12-
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

‎.github/workflows/auto-comment.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Auto Comment
2+
on:
3+
issues:
4+
types:
5+
- opened
6+
- closed
7+
- assigned
8+
pull_request:
9+
types:
10+
- opened
11+
- closed
12+
13+
jobs:
14+
run:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Auto Comment on Issues Opened
18+
uses: wow-actions/auto-comment@v1
19+
with:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
issuesOpened: |
22+
👋 @{{ author }}
23+
24+
Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
25+
26+
Please make sure you have given us as much context as possible.
27+
28+
- name: Auto Comment on Issues Closed
29+
uses: wow-actions/auto-comment@v1
30+
with:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
issuesClosed: |
33+
👋 @{{ author }} This issue is closed.
34+
35+
- name: Auto Comment on Pull Request Merged
36+
uses: wow-actions/auto-comment@v1
37+
with:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
pullRequestMerged: |
40+
👋 @{{ author }} 🎉 Congrats on your merged pull request! Thanks for the valuable contribution! 👏🎉 Congrats on your merged pull request! Thanks for the valuable contribution! 👏
41+
42+
- name: Auto Comment on Pull Request Opened
43+
uses: wow-actions/auto-comment@v1
44+
with:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
pullRequestOpened: |
47+
Hello👋 @{{ author }}, I hope you are doing well!
48+
<br>
49+
Thank you for raising your pull request and contributing to our Community 🎉
50+
51+
Please make sure you have followed our contributing guidelines. We will review it as soon as possible.
52+
53+
- name: Auto Comment on Issues Assigned
54+
uses: wow-actions/auto-comment@v1
55+
with:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
issuesAssigned: |
58+
Hello @{{ author }}, thank you for raising an issue. 🙌 I have assigned the issue to you. You can now start working on it. If you encounter any problems, please feel free to connect with us. 👍
59+
60+

‎.github/workflows/codeql.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
schedule:
9+
- cron: '37 21 * * 4'
10+
11+
jobs:
12+
analyze:
13+
name: Analyze
14+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
15+
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
16+
permissions:
17+
actions: read
18+
contents: read
19+
security-events: write
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
language: [ 'javascript', 'python' ]
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v3
28+
29+
- name: Initialize CodeQL
30+
uses: github/codeql-action/init@v2
31+
with:
32+
languages: ${{ matrix.language }}
33+
- name: Autobuild
34+
uses: github/codeql-action/autobuild@v2
35+
36+
- name: Perform CodeQL Analysis
37+
uses: github/codeql-action/analyze@v2
38+
with:
39+
category: "/language:${{matrix.language}}"

‎.github/workflows/greetings.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

‎.github/workflows/py_lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
# Checkout the code base #
3737
##########################
3838
- name: Checkout Code
39-
uses: actions/checkout@v2
39+
uses: actions/checkout@v3
4040
with:
4141
# Full git history is needed to get a proper list of changed files within `super-linter`
4242
fetch-depth: 0
@@ -45,7 +45,7 @@ jobs:
4545
# Run Linter against code base #
4646
################################
4747
- name: Lint Code Base
48-
uses: github/super-linter@v3
48+
uses: github/super-linter@v5
4949
env:
5050
VALIDATE_ALL_CODEBASE: false
5151
VALIDATE_PYTHON: true

‎AI Calculator/main.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from chatterbot import ChatBot
2+
3+
# naming the ChatBot calculator
4+
# using mathematical evaluation logic
5+
# the calculator AI will not learn with the user input
6+
Bot = ChatBot(name = 'Calculator',
7+
read_only = True,
8+
logic_adapters = ["chatterbot.logic.MathematicalEvaluation"],
9+
storage_adapter = "chatterbot.storage.SQLStorageAdapter")
10+
11+
12+
# clear the screen and start the calculator
13+
print('033円c')
14+
print("Hello, I am a calculator. How may I help you?")
15+
while (True):
16+
# take the input from the user
17+
user_input = input("me: ")
18+
19+
# check if the user has typed quit to exit the prgram
20+
if user_input.lower() == 'quit':
21+
print("Exiting")
22+
break
23+
24+
# otherwise, evaluate the user input
25+
# print invalid input if the AI is unable to comprehend the input
26+
try:
27+
response = Bot.get_response(user_input)
28+
print("Calculator:", response)
29+
except:
30+
print("Calculator: Please enter valid input.")
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Telegram AI Image Generator Bot
2+
This is an AI Image generator bot. It can create original images from a single text prompt!
3+
4+
5+
# Screenshot
6+
![Bot Screenshot](telegramBotScreenShot.png)
7+
8+
9+
# Getting Started
10+
This package is simple to use and allows to build an image generation telegram bot
11+
12+
## Prerequisites
13+
14+
- Python
15+
- Telegram Bot API Key
16+
- Replicate Stable Diffusion API Key
17+
18+
## Installation
19+
20+
21+
22+
1. Get a free telegram bot API key from @BotFather telegram bot.
23+
2. Also get a free stable diffusion API key from https://replicate.com/account/api-tokens
24+
![Replicate Screenshot](replicatess.png)
25+
3. Clone the repo
26+
`git clone https://github.com/<your_username>/Amazing-Python-Scripts`
27+
`cd ai_image_generation_telegram_bot`
28+
3. Install the requirements from the requirements.txt file
29+
` pip install -r requirements.txt`
30+
4. Enter the bot token from BotFather in the **TELEGRAM_BOT_TOKEN** in the .env file.
31+
5. Enter the bot token from Replicate in the **REPLICATE_API_TOKEN** in the .env file.
32+
6. Now run the ai_bot.py file and start chatting.
33+
34+
# Bot Commands
35+
You can see a list of commands by typing */help*
36+
37+
| Commands | Description |
38+
|-------------------|-----------------------------------------------|
39+
| /start | Start a conversation |
40+
| /help | Get a list of all the commands |
41+
| /imagine `prompt` | Create an image based on the given command |
42+
43+
#
44+
*Created by [Arnav Kohli](https://github.com/THEGAMECHANGER416)*
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
from dotenv import load_dotenv
2+
import os
3+
from telegram import Update
4+
import replicate
5+
from telegram.ext import ApplicationBuilder, CommandHandler, ContextTypes, MessageHandler, filters
6+
7+
load_dotenv()
8+
9+
10+
def getUrl(prompt):
11+
a = replicate.run(
12+
"stability-ai/stable-diffusion:27b93a2413e7f36cd83da926f3656280b2931564ff050bf9575f1fdf9bcd7478",
13+
input={"prompt": prompt}
14+
)
15+
print(a)
16+
return a[0]
17+
18+
19+
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
20+
await update.message.reply_text(
21+
f"Hello {update.effective_user.first_name} I am your personal AI Image Generator \n Use /help to know all commands.")
22+
23+
24+
async def help(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
25+
await update.message.reply_text(
26+
'''Here are a list of all commands:-
27+
/start - Start a conversation
28+
/help - Get a list of commands
29+
/imagine <prompt> - Get an AI generated image'''
30+
)
31+
32+
33+
async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE):
34+
await update.message.reply_text("""
35+
Sorry, I did not understand that command.
36+
Type \" /help \" to see all possible commands""")
37+
38+
39+
async def imagine(update: Update, context: ContextTypes.DEFAULT_TYPE):
40+
arg = str(" ".join(context.args))
41+
url = getUrl(arg)
42+
await update.message.reply_photo(url)
43+
44+
45+
app = ApplicationBuilder().token(os.environ.get('TELEGRAM_BOT_TOKEN')).build()
46+
app.add_handler(CommandHandler("start", start))
47+
app.add_handler(CommandHandler("help", help))
48+
app.add_handler(CommandHandler("imagine", imagine))
49+
app.add_handler(MessageHandler(filters.COMMAND, handle_message))
50+
app.run_polling()
18.7 KB
Loading[フレーム]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
requests
2+
python-telegram-bot
3+
python-dotenv
4+
replicate

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /