Spaces:
Runtime error
Runtime error
File size: 1,239 Bytes
8f64cac 94e67a7 8f64cac |
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 |
#!/usr/bin/env python3
#
# SPDX-FileCopyrightText: Hadad <hadad@linuxmail.org>
# SPDX-License-Identifier: Apache-2.0
#
import sys
from gradio_client import Client
from rich.console import Console
from rich.markdown import Markdown
console = Console()
jarvis = Client("hadadrjt/ai")
model = "JARVIS: 2.1.2" # You can change the models here.
args = sys.argv[1:]
deep_search = False
if "-d" in args:
deep_search = True
args.remove("-d")
input_text = " ".join(args) if args else "Hi!"
jarvis.predict(new=model, api_name="/change_model")
if deep_search and model != "JARVIS: 2.1.2": # DO NOT CHANGE THIS!
console.print("")
console.print("------------------------------------------------------")
console.print("[bold red]Deep Search is only available for model JARVIS: 2.1.2.[/bold red]")
console.print("------------------------------------------------------")
console.print("")
deep_search = False
if deep_search:
result = jarvis.predict(
multi={"text": input_text},
deep_search=True,
api_name="/respond_async")
else:
result = jarvis.predict(
multi={"text": input_text},
api_name="/api")
response_text = result[0][0][1]
console.print(Markdown(response_text))
|