Jyotiyadav commited on
Commit
4fa6b5f
·
verified ·
1 Parent(s): 16c1e88

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -1
app.py CHANGED
@@ -6,7 +6,7 @@ from transformers import pipeline
6
  auth_token = os.environ.get("HUGGING_FACE_HUB_TOKEN")
7
 
8
  # Function to generate output based on input
9
- def generate_output(prompt,max_new_tokens, temperature, top_k, top_p, model):
10
  # Initialize the pipeline
11
  pipe = pipeline(
12
  "text-generation",
@@ -15,6 +15,39 @@ def generate_output(prompt,max_new_tokens, temperature, top_k, top_p, model):
15
  torch_dtype=torch.bfloat16,
16
  device_map="auto"
17
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  # Generate the result
20
  result = pipe(
 
6
  auth_token = os.environ.get("HUGGING_FACE_HUB_TOKEN")
7
 
8
  # Function to generate output based on input
9
+ def generate_output(input_text,max_new_tokens, temperature, top_k, top_p, model):
10
  # Initialize the pipeline
11
  pipe = pipeline(
12
  "text-generation",
 
15
  torch_dtype=torch.bfloat16,
16
  device_map="auto"
17
  )
18
+
19
+ prompt = f"""
20
+ Your task is to extract the information corresponding to the provided labels from the below given email.
21
+
22
+ ### Instruction:
23
+ * pickup_location: Street address of the origin location of goods.
24
+ * pickup_cap: Postal code or ZIP code of the pickup location.
25
+ * pickup_port: Port of pickup, often used in international shipping.
26
+ * pickup_state: Only Country of pickup location.
27
+ * delivery_location: Street address of the destination location of goods.
28
+ * delivery_cap: Postal code or ZIP code of delivery location.
29
+ * delivery_port: Port of delivery, similar to pickup port.
30
+ * delivery_state: State or region of delivery location.
31
+ * total_quantity: Overall quantity of shipped items (e.g., pieces, boxes). Calculate the total_quantity by summing the quantity of all packages.
32
+ * total_weight: Total weight of the shipment (e.g., kg, lbs). Calculate the total_weight by summing the weights of all packages.
33
+ * total_volume: Total volume of the shipment (e.g., cubic meters, cubic feet). Calculate the total_volume by summing the volumes of all packages.
34
+ * quantity: Individual Quantity of a specific item being shipped.
35
+ * package_type: Individual Type of packaging used (e.g., pallets, cartons).
36
+ * weight: Individual Weight of a specific package.
37
+ * measures: Individual Dimensions or measurements of a package.
38
+ * stackable: Indicates whether the shipment is stackable (True or False).
39
+ * volume: Individual Volume of a specific package.
40
+ * commodity: Type of goods or commodities being shipped.
41
+ * company: Name of the email sending company, also the shipping company or carrier.
42
+ * incoterms: Choose available options: EXW, FCA, FAS, FOB, CFR, CIF, CPT, CIP, DAP, DPU, DDP.
43
+
44
+ For attributes with multiple values, such as measures, volume, weight, package_type, and quantity, provide each value separately in a JSON format.
45
+
46
+ ### Input:
47
+ ```{input_text}```
48
+
49
+ ### Response:
50
+ """
51
 
52
  # Generate the result
53
  result = pipe(