Spaces:
Sleeping
Sleeping
File size: 3,890 Bytes
c5b7eda 0b1d9d6 e9e4ec6 b8d1916 0b1d9d6 b0675b4 0b1d9d6 b8d1916 0b1d9d6 b0675b4 0b1d9d6 b8d1916 c5b7eda b8d1916 0b1d9d6 b8d1916 0b1d9d6 b8d1916 e9e4ec6 0b1d9d6 e9e4ec6 b8d1916 0b1d9d6 b8d1916 0b1d9d6 e9e4ec6 b8d1916 0b1d9d6 c5b7eda 0b1d9d6 b8d1916 0b1d9d6 c5b7eda 0b1d9d6 c5b7eda 0b1d9d6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
import gradio as gr
import requests
# API endpoint URL for the Horoscope API
API_URL = "https://ai-research.quarkgen.ai/templedekho/match_maker/v1"
def get_horoscope_response(name1, year1, month1, day1, hour1, minute1, city1, country1,
name2, year2, month2, day2, hour2, minute2, city2, country2, language):
"""
Send a POST request to the horoscope API with the user-provided parameters.
"""
# Prepare the input payload
payload = {
"name1": name1,
"year1": int(year1),
"month1": int(month1),
"day1": int(day1),
"hour1": int(hour1),
"minute1": int(minute1),
"city1": city1,
"country1": country1, # Fixed key from "county1" to "country1"
"name2": name2,
"year2": int(year2),
"month2": int(month2),
"day2": int(day2),
"hour2": int(hour2),
"minute2": int(minute2),
"city2": city2,
"country2": country2, # Fixed key from "county2" to "country2"
"language": language
}
# Send the POST request
response = requests.post(API_URL, json=payload)
# Check if the request was successful
if response.status_code == 200:
response_data = response.text
return response_data
else:
return f"Sorry, there was an error with your request. Status Code: {response.status_code}"
# Define the Gradio interface
def create_gradio_interface():
"""
Creates the Gradio user interface for AI Guru Astrologer.
"""
# Title and description for the interface
title = "AI Guru Match Maker"
description = "Enter your and your partner's details below to get personalized astrological aspects and match-making predictions from the AI Guru."
# Define inputs for Person 1
name1 = gr.Textbox(label="Name (Person 1)", placeholder="Enter the name of Person 1")
year1 = gr.Number(label="Birth Year (Person 1)")
month1 = gr.Number(label="Birth Month (Person 1)")
day1 = gr.Number(label="Birth Day (Person 1)")
hour1 = gr.Number(label="Birth Hour (Person 1) (24-hour format)")
minute1 = gr.Number(label="Birth Minute (Person 1)")
city1 = gr.Textbox(label="Birth City (Person 1)", placeholder="Enter the city of birth")
country1 = gr.Textbox(label="Birth Country (Person 1)", placeholder="Enter the country of birth")
# Define inputs for Person 2
name2 = gr.Textbox(label="Name (Person 2)", placeholder="Enter the name of Person 2")
year2 = gr.Number(label="Birth Year (Person 2)")
month2 = gr.Number(label="Birth Month (Person 2)")
day2 = gr.Number(label="Birth Day (Person 2)")
hour2 = gr.Number(label="Birth Hour (Person 2) (24-hour format)")
minute2 = gr.Number(label="Birth Minute (Person 2)")
city2 = gr.Textbox(label="Birth City (Person 2)", placeholder="Enter the city of birth")
country2 = gr.Textbox(label="Birth Country (Person 2)", placeholder="Enter the country of birth")
# Language selection
language = gr.Textbox(label="Language (Language Code)", placeholder="Enter the Language code (e.g., EN, HI)")
# Output component for the response
response_output = gr.Textbox(label="AI Guru Astrologer's Response")
# Gradio interface layout
iface = gr.Interface(
fn=get_horoscope_response,
inputs=[name1, year1, month1, day1, hour1, minute1, city1, country1, name2, year2, month2, day2, hour2, minute2, city2, country2, language],
outputs=[response_output],
title=title,
description=description,
live=False, # The API call will be made when the user clicks the submit button
allow_flagging="never" # Disable flagging option
)
# Launch the Gradio interface
iface.launch()
# Main entry point to run the Gradio interface
if __name__ == "__main__":
create_gradio_interface()
|