Moiz commited on
Commit
78e8840
·
1 Parent(s): b754266
Files changed (1) hide show
  1. app.py +13 -14
app.py CHANGED
@@ -18,16 +18,9 @@ def fetch_movie_info():
18
  box_office = movie_data.get("BoxOffice", "N/A")
19
  genre = movie_data.get("Genre", "N/A")
20
 
21
- return (
22
- f"**Title:** {title}\n"
23
- f"**Year:** {year}\n"
24
- f"**Genre:** {genre}\n"
25
- f"**Plot:** {plot}\n"
26
- f"**IMDb Rating:** {imdb_rating}/10\n"
27
- f"**Box Office:** {box_office}\n"
28
- )
29
  else:
30
- return f"Error: {movie_data.get('Error', 'Movie not found.')}"
31
  else:
32
  return f"Failed to fetch movie details. HTTP Status Code: {response.status_code}"
33
 
@@ -37,10 +30,16 @@ with gr.Blocks(css="styles.css") as app:
37
  gr.Markdown(
38
  "This app automatically fetches and displays information about the movie: *The Secret in Their Eyes*."
39
  )
40
- output = gr.Textbox(
41
- label="Movie Details",
42
- lines=10,
43
- value=fetch_movie_info() # Assign fetched movie details directly
44
- )
 
 
 
 
 
 
45
 
46
  app.launch()
 
18
  box_office = movie_data.get("BoxOffice", "N/A")
19
  genre = movie_data.get("Genre", "N/A")
20
 
21
+ return title, year, genre, plot, imdb_rating, box_office
 
 
 
 
 
 
 
22
  else:
23
+ return "Error", "Error", "Error", "Error", "Error", "Error"
24
  else:
25
  return f"Failed to fetch movie details. HTTP Status Code: {response.status_code}"
26
 
 
30
  gr.Markdown(
31
  "This app automatically fetches and displays information about the movie: *The Secret in Their Eyes*."
32
  )
33
+
34
+ # Fetch movie details and display in separate elements
35
+ title_output = gr.Textbox(label="Title", lines=1, value=fetch_movie_info()[0])
36
+ year_output = gr.Textbox(label="Year", lines=1, value=fetch_movie_info()[1])
37
+ genre_output = gr.Textbox(label="Genre", lines=1, value=fetch_movie_info()[2])
38
+ plot_output = gr.Textbox(label="Plot", lines=5, value=fetch_movie_info()[3])
39
+ imdb_rating_output = gr.Textbox(label="IMDb Rating", lines=1, value=fetch_movie_info()[4])
40
+ box_office_output = gr.Textbox(label="Box Office", lines=1, value=fetch_movie_info()[5])
41
+
42
+ # Adding a slider
43
+ slider = gr.Slider(minimum=0, maximum=10, step=0.25, label="Rating Slider")
44
 
45
  app.launch()