Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import requests
|
| 3 |
+
|
| 4 |
+
# Function to call your API
|
| 5 |
+
def call_jira_api(jira_ticket_header):
|
| 6 |
+
try:
|
| 7 |
+
# Your API endpoint
|
| 8 |
+
api_url = "https://znwkjn2kig.execute-api.us-east-1.amazonaws.com/dev"
|
| 9 |
+
|
| 10 |
+
# Request payload
|
| 11 |
+
payload = {"jira_ticket_header": jira_ticket_header}
|
| 12 |
+
|
| 13 |
+
# Make the API call
|
| 14 |
+
response = requests.post(api_url, json=payload)
|
| 15 |
+
|
| 16 |
+
# Handle response
|
| 17 |
+
if response.status_code == 200:
|
| 18 |
+
return response.json()
|
| 19 |
+
else:
|
| 20 |
+
return f"Error {response.status_code}: {response.text}"
|
| 21 |
+
except Exception as e:
|
| 22 |
+
return f"Error: {str(e)}"
|
| 23 |
+
|
| 24 |
+
# Gradio Interface
|
| 25 |
+
iface = gr.Interface(
|
| 26 |
+
fn=call_jira_api, # Function to call
|
| 27 |
+
inputs=gr.Textbox(label="Jira Ticket Header"), # Input field
|
| 28 |
+
outputs="text", # Output as text
|
| 29 |
+
title="Jira Description Generator",
|
| 30 |
+
description="Enter the Jira ticket header to generate a description."
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
# Launch the app
|
| 34 |
+
iface.launch()
|