AccioINTERN / app.py
trexhere's picture
Create app.py
7514ed6 verified
raw
history blame
No virus
800 Bytes
import gradio as gr
import requests
import os
def invite_user(username):
GITHUB_TOKEN = os.getenv('GITHUB_TOKEN')
GITHUB_ORG = os.getenv('GITHUB_ORG')
response = requests.post(
f'https://api.github.com/orgs/{GITHUB_ORG}/invitations',
headers={
'Authorization': f'token {GITHUB_TOKEN}',
'Accept': 'application/vnd.github.v3+json',
'Content-Type': 'application/json',
},
json={'invitee_id': username}
)
if response.ok:
return f'Invitation sent to {username}'
else:
return f'Error: {response.json().get("message", "Unknown error")}'
iface = gr.Interface(
fn=invite_user,
inputs='text',
outputs='text',
title='Join AccioINTERN'
)
if __name__ == "__main__":
iface.launch()