Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub
Browse files- .github/workflows/update_space.yml +28 -0
- Demo.ipynb +0 -0
- Demo_Visual/Image_1.jpg +0 -0
- Demo_Visual/Image_2.jpg +0 -0
- Demo_Visual/generated_image.png +0 -0
- Discord.py +53 -0
- README.md +2 -8
- requirements.txt +1 -0
.github/workflows/update_space.yml
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Run Python script
|
2 |
+
|
3 |
+
on:
|
4 |
+
push:
|
5 |
+
branches:
|
6 |
+
- main
|
7 |
+
|
8 |
+
jobs:
|
9 |
+
build:
|
10 |
+
runs-on: ubuntu-latest
|
11 |
+
|
12 |
+
steps:
|
13 |
+
- name: Checkout
|
14 |
+
uses: actions/checkout@v2
|
15 |
+
|
16 |
+
- name: Set up Python
|
17 |
+
uses: actions/setup-python@v2
|
18 |
+
with:
|
19 |
+
python-version: '3.9'
|
20 |
+
|
21 |
+
- name: Install Gradio
|
22 |
+
run: python -m pip install gradio
|
23 |
+
|
24 |
+
- name: Log in to Hugging Face
|
25 |
+
run: python -c 'import huggingface_hub; huggingface_hub.login(token="${{ secrets.hf_token }}")'
|
26 |
+
|
27 |
+
- name: Deploy to Spaces
|
28 |
+
run: gradio deploy
|
Demo.ipynb
ADDED
The diff for this file is too large to render.
See raw diff
|
|
Demo_Visual/Image_1.jpg
ADDED
![]() |
Demo_Visual/Image_2.jpg
ADDED
![]() |
Demo_Visual/generated_image.png
ADDED
![]() |
Discord.py
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import discord
|
2 |
+
import os
|
3 |
+
import asyncio
|
4 |
+
from discord.ext import commands
|
5 |
+
|
6 |
+
# Replace with your bot token
|
7 |
+
TOKEN = "MTI0NDI2NTU5MDc1MjAyMjU4Mg.G-KWFf.2mjabK1nmRsXRRBrbqxrWGEIXkGt_CLzFvP_CA"
|
8 |
+
# Replace with your channel ID
|
9 |
+
CHANNEL_ID = 1238313627266711573
|
10 |
+
|
11 |
+
# Initial address for the image folder
|
12 |
+
IMAGE_FOLDER = r"C:\Users\shash\Downloads\Automation\Hf_Demo\Demo_Visual"
|
13 |
+
|
14 |
+
# Define the intents
|
15 |
+
intents = discord.Intents.default()
|
16 |
+
intents.message_content = True
|
17 |
+
|
18 |
+
# Bot command prefix
|
19 |
+
bot = commands.Bot(command_prefix='!', intents=intents)
|
20 |
+
|
21 |
+
@bot.event
|
22 |
+
async def on_ready():
|
23 |
+
print(f'Logged in as {bot.user.name}')
|
24 |
+
print('------')
|
25 |
+
|
26 |
+
@bot.command()
|
27 |
+
async def upload_image(ctx, *,image_name):
|
28 |
+
file_path = os.path.join(IMAGE_FOLDER, image_name)
|
29 |
+
if not os.path.isfile(file_path):
|
30 |
+
await ctx.send(f'File {image_name} not found.')
|
31 |
+
return
|
32 |
+
|
33 |
+
if not image_name.lower().endswith(('.png', '.jpg', '.jpeg', '.gif')):
|
34 |
+
await ctx.send(f'File {image_name} is not a valid image format.')
|
35 |
+
return
|
36 |
+
|
37 |
+
try:
|
38 |
+
await ctx.send(file=discord.File(file_path))
|
39 |
+
print(f'Uploaded {image_name}')
|
40 |
+
except Exception as e:
|
41 |
+
print(f'Error uploading image: {e}')
|
42 |
+
|
43 |
+
# Run the bot within an event loop
|
44 |
+
async def run_bot():
|
45 |
+
try:
|
46 |
+
await bot.start(TOKEN)
|
47 |
+
except Exception as e:
|
48 |
+
print(f'Error starting bot: {e}')
|
49 |
+
|
50 |
+
# Create an event loop and run the bot
|
51 |
+
loop = asyncio.get_event_loop()
|
52 |
+
loop.create_task(run_bot())
|
53 |
+
loop.run_forever()
|
README.md
CHANGED
@@ -1,12 +1,6 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
|
4 |
-
colorFrom: green
|
5 |
-
colorTo: yellow
|
6 |
sdk: gradio
|
7 |
sdk_version: 4.37.2
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: Visual_Paraphrase-Midjourney
|
3 |
+
app_file: Demo.ipynb
|
|
|
|
|
4 |
sdk: gradio
|
5 |
sdk_version: 4.37.2
|
|
|
|
|
6 |
---
|
|
|
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
selenium
|